Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Support swc ts-node option.#302

Open
shahmirn wants to merge 1 commit into
wclr:masterfrom
shahmirn:master
Open

Support swc ts-node option.#302
shahmirn wants to merge 1 commit into
wclr:masterfrom
shahmirn:master

Conversation

@shahmirn

Copy link
Copy Markdown

No description provided.

@shahmirn

Copy link
Copy Markdown
Author

@wclr Could you take a look at this PR? It should be fairly minor.

@KyleAMathews

Copy link
Copy Markdown

Keen to try this out! We've got a large code base that takes ~30s to startup right now and would love to cut that down.

@frederikvanhevel

Copy link
Copy Markdown

+1

@matsko

matsko commented Apr 8, 2022

Copy link
Copy Markdown

Any progress on this?

@cspotcode

Copy link
Copy Markdown

ts-node can pull all of these options from your tsconfig.json, is there some reason that can't be done when using ts-node-dev?

https://typestrong.org/ts-node/docs/configuration#via-tsconfigjson-recommended

@emaciel10

Copy link
Copy Markdown

Any updates here? This would also reduce our build times by quite a bit

@rafaell-lycan

Copy link
Copy Markdown

+1

@hansott

hansott commented Aug 15, 2022

Copy link
Copy Markdown

If you want an alternative solution, I've switched ts-node-dev to https://github.com/esbuild-kit/tsx, it's great! :)

ts-node-dev was always causing problems (high CPU, compatibility macOS/Linux) and I wanted a tool that combined watching and transpiling (so that I didn't have to install something like nodemon)

Example: npx tsx watch ./file.tsx

(I'm unaffiliated with tsx)

@rubnogueira

Copy link
Copy Markdown

@wclr Could you take a look at this PR? Basically, we cannot use this tool with ts-node + swc, since it overrides the transpileOnly property.

@akwodkiewicz akwodkiewicz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chosen option alias is not present in the ts-node docs.

Comment thread src/bin.ts

const tsNodeAlias = {
'transpile-only': 'T',
'swc': 'W',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from what I can see in the official docs, ts-node does not use -W short flag for swc, there's only a full --swc option

Comment thread src/compiler.ts
files: options['files'],
pretty: options['pretty'],
transpileOnly: options['transpile-only'],
transpileOnly: options['transpile-only'] ? true : undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the original options['transpile-only'] assignment not working properly? Is there an edge case that had to be resolved with a ternary operator?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants